package com.yxh.lib_base.ext.xpopup

import com.lxj.xpopup.XPopup
import com.lxj.xpopup.core.BasePopupView

/**
 * 作者 : yuan_xh
 * 时间 : 2022/8/19 16:00
 * 说明 : 自定义XPopup构建封装
 */

fun BasePopupView.builder(builder: (XPopup.Builder.() -> Unit)? = null): BasePopupView {
    val mBuilder = XPopup.Builder(context)
    builder?.invoke(mBuilder)
    mBuilder.asCustom(this)
    return this
}

/**
 * 显示确定弹窗
 */
fun XPopup.Builder.showConfirm(
    title: String? = null,
    content: String,
    confirm: (() -> Unit)? = null,
) {
    this.asConfirm(title, content) {
        confirm?.invoke()
    }.show()
}

/**
 * 显示选择支付方式弹窗
 */
fun XPopup.Builder.showPayWay(sure: (() -> Unit)? = null) {

}